package cglib;

import net.sf.cglib.proxy.Enhancer;

/**
 * @Author:zimmor
 * @Date: 2021/3/25 12:29
 * @Description cglib动态代理测试
 * @version: 1.0.0
 */

public class DynamicProxyDemo1 {
    public static void main(String[] args) {
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(Buyer.class);
        enhancer.setCallback(new CglibMethodInterceptor());
        Buyer proxy = (Buyer) enhancer.create();
        System.out.println("proxy.buybuybuy() = " + proxy.buybuybuy());
        proxy.buyAK("AK47");
    }
}
